/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.google.code.jmarias.server.phases;

import com.google.code.jmarias.common.action.ChooseBetlAction;
import com.google.code.jmarias.common.action.ChooseDurchAction;
import com.google.code.jmarias.common.action.GameAction;

/**
 *
 * @author josef
 */
public class ChooseGamePhase extends AbstractPhase {

    private int badPlayerIndex;

    public ChooseGamePhase(int badPlayerIndex) {
        this.badPlayerIndex = badPlayerIndex;
    }

    public AbstractPhase processAction(GameAction action) {
        if (isSameAction(ChooseBetlAction.class, action)) {
            return processChooseBetlAction((ChooseBetlAction) action);
        }
        if (isSameAction(ChooseDurchAction.class, action)) {
            return processChooseDurchAction((ChooseDurchAction) action);
        }
        return null;
    }

    private AbstractPhase processChooseBetlAction(ChooseBetlAction action) {
        return new BetlDecisionPhase(badPlayerIndex, 0);
    }

    private AbstractPhase processChooseDurchAction(ChooseDurchAction action) {
        return new DurchFlekPhase();
    }
}
